CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/_TDD.py.in ${BTK_EXECUTABLE_PATH}/TDD.py)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/_TDDConfigure.py.in ${CMAKE_CURRENT_BINARY_DIR}/_TDDConfigure.py)

# Generate MuteCerr
FIND_PACKAGE(SWIG 2.0 REQUIRED)
FIND_PACKAGE(PythonLibs REQUIRED)
INCLUDE(${SWIG_USE_FILE})
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
# INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SWIG_FLAGS "")
SET(CMAKE_SWIG_OUTDIR "${BTK_BINARY_DIR}/Testing/Python")
SET(LIBRARY_OUTPUT_PATH "${BTK_BINARY_DIR}/Testing/Python") # Custom output path
SET_SOURCE_FILES_PROPERTIES(_TDDMuteCerr.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(MuteCerr python _TDDMuteCerr.i)
IF(WIN32 AND NOT CYGWIN)
  SET_TARGET_PROPERTIES(${SWIG_MODULE_MuteCerr_REAL_NAME} PROPERTIES SUFFIX ".pyd")
ENDIF(WIN32 AND NOT CYGWIN)
SWIG_LINK_LIBRARIES(MuteCerr ${PYTHON_LIBRARIES})

ADD_TEST(NAME "TDD_Python" WORKING_DIRECTORY ${BTK_EXECUTABLE_PATH} COMMAND ${PYTHON_EXECUTABLE} "TDD.py")